package org.dong.samples.model;

import java.io.Serializable;
import java.sql.Date;
import java.sql.Timestamp;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.validator.constraints.NotEmpty;
@Entity
@Table(name = "exam_user")
public class User implements Serializable {
	private static final long serialVersionUID = -8141052643109673188L;
	
	@NotEmpty(message = "ID不能为空！")
	@Id
	@Column(name = "user_id", nullable = false)
	private String userId;
	
	@NotEmpty(message = "姓名不能为空！")
	@Column(name = "user_name", length = 45, nullable = false)
	private String userName;
	
	@Column(name = "password", length = 255, nullable = false)
	private String password;
	
	@Column(name = "tel", length = 20)
	private String tel;
	
	@Column(name = "email", length = 255)
	private String email;
	
	@Column(name = "address", length = 255)
	private String address;
	
	@Column(name = "birthday", nullable = false)
	private Date birthday;
	
	@Column(name = "gender", nullable = false)
	private Integer gender;
	
	@Column(name = "last_lock_time")
	private Timestamp lastLockTime;
	
	@Column(name = "login_fail_count")
	private int loginFailCount;
	
	@OneToMany(mappedBy = "user")
	private Set<UserSubject> userSubject;
	
	public User() {
		super();
	}

	public User(String userId, String userName, String password, String tel, String email, String address,
			Date birthday, Integer gender, Timestamp lastLockTime, int loginFailCount, Set<UserSubject> userSubject) {
		super();
		this.userId = userId;
		this.userName = userName;
		this.password = password;
		this.tel = tel;
		this.email = email;
		this.address = address;
		this.birthday = birthday;
		this.gender = gender;
		this.lastLockTime = lastLockTime;
		this.loginFailCount = loginFailCount;
		this.userSubject = userSubject;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public Integer getGender() {
		return gender;
	}

	public void setGender(Integer gender) {
		this.gender = gender;
	}

	public Timestamp getLastLockTime() {
		return lastLockTime;
	}

	public void setLastLockTime(Timestamp lastLockTime) {
		this.lastLockTime = lastLockTime;
	}

	public int getLoginFailCount() {
		return loginFailCount;
	}

	public void setLoginFailCount(int loginFailCount) {
		this.loginFailCount = loginFailCount;
	}

	public Set<UserSubject> getUserSubject() {
		return userSubject;
	}

	public void setUserSubject(Set<UserSubject> userSubject) {
		this.userSubject = userSubject;
	}

	
}
